package com.back.service.impl;

import com.back.domain.VO.SYSTEM.SysRolePagingBody;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.back.domain.SysRole;
import com.back.service.SysRoleService;
import com.back.mapper.SysRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author 陈胜杰
* @description 针对表【sys_role(角色)】的数据库操作Service实现
* @createDate 2024-07-12 10:21:35
*/
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole>
    implements SysRoleService{
@Autowired
private SysRoleMapper sysRoleMapper;

@Override
public IPage<SysRole> SelectData(SysRolePagingBody pagingBody) {
    int offset = pagingBody.getOffset();
    int limit = pagingBody.getLimit();


    // 创建分页对象
    IPage<SysRole> page = new Page<>(offset, limit);
    LambdaQueryWrapper<SysRole> lqw = new LambdaQueryWrapper<>();
        lqw.like( pagingBody.getRoleName()!=null,SysRole::getRoleName, pagingBody.getRoleName());
    // 执行分页查询
    return  sysRoleMapper.selectPage(page,lqw);
}

}




